import { Component, OnInit } from "@angular/core";
import { CommService } from "./comm-service";
import { Router } from "@angular/router";
import { MyhttpService } from "./myhttp.service";
import { LocalStorageService } from "./local-storage-service";

declare var swal: any;
declare var $: any;

@Component({
  template: `
    <div class="uppwdRoom" [style.height]="pwdroomHeightstr">
      <div class="row">
        <div class="col-lg-12">
          <div class="portlet">
            <h3 class="page-title">用户中心</h3>
            <div class="page-bar">
              <ul class="page-breadcrumb">
                <li>
                  <i class="fa fa-home"></i>
                  <a href="javascript:void(0)">{{loginname}}</a>
                  <i class="fa fa-angle-right"></i>
                </li>
                <li>
                  <a href="javascript:void(0)">{{label}}</a>
                </li>
              </ul>
              <!-- <div class="pull-right">
                <div class="btn2" style="background-color:#d5dade">
                  <i class="fa fa-file-image-o" style="color:#FFFFFF; font-size:22px; margin-top:10px"></i>
                </div>
              </div> -->
            </div>
          </div>
        </div>
      </div>
      <form class="form-horizontal" role="form">
        <div class="alert alert-success display-block" *ngIf="successflag_mm">
          <span>{{successtext_mm}}</span>
        </div>
        <div id="xgpwdRoom">
          <!--旧密码-->
          <div class="row">
            <div class="col-lg-8">
              <div class="form-group">
                <label class="col-lg-3 control-label">
                  <span class="redstart">*</span>旧密码:</label>
                <div class="col-lg-9">
                  <input type="password" class="form-control" name="oldpwd" [(ngModel)]="noReactiveFormField.oldpwdv"/>
                </div>
              </div>
            </div>
            <div class="col-lg-4">
              <div *ngIf="noReactiveFormField.oldpwdwarn"
                   style="background-color: #FFEFEF;width: 100%;height: 33px;text-align: center;">
                <span style="line-height: 33px;color: red">{{noReactiveFormField.oldpwdwarntext}}</span>
              </div>
            </div>
          </div>
          <!--新密码-->
          <div class="row">
            <div class="col-lg-8">
              <div class="form-group">
                <label class="col-lg-3 control-label"><span class="redstart">*</span>新密码:</label>
                <div class="col-lg-9">
                  <input type="password" class="form-control" name="newpwd" [(ngModel)]="noReactiveFormField.newpwdv"
                         (keyup)="newpwdChange()" (focus)="showProp()"/>
                  <div id="tips">
                    <span></span>
                    <span></span>
                    <span></span>
                    <label>{{noReactiveFormField.newpwdqdtx}}</label>
                  </div>
                </div>
              </div>
            </div>
            <div class="col-lg-4">
              <div id="gzPpopover"></div>
              <div id="gzerror" *ngIf="noReactiveFormField.newpwdwarn">
                <span>{{noReactiveFormField.newpwdwarntext}}</span>
              </div>
            </div>
          </div>
          <!--确认密码-->
          <div class="row">
            <div class="col-lg-8">
              <div class="form-group">
                <label class="col-lg-3 control-label"><span class="redstart">*</span>确认密码：</label>
                <div class="col-lg-9">
                  <input type="password" class="form-control" name="qrpwd" [(ngModel)]="noReactiveFormField.qrpwdv"
                         (keyup)="qrpwdChange()"/>
                </div>
              </div>
            </div>
            <div class="col-lg-4">
              <div *ngIf="noReactiveFormField.rqpwdwarn"
                   style="background-color: #FFEFEF;width: 100%;height: 33px;text-align: center;">
                <span style="line-height: 33px;color: red">{{noReactiveFormField.rqpwdwarntext}}</span>
              </div>
            </div>
          </div>
        </div>

        <!--绑定手机号-->
        <div class="alert alert-success display-block" *ngIf="successflag_sjh">
          <span>{{successtext_sjh}}</span>
        </div>
        <div id="wsxxRoom">
          <div class="row">
            <div class="col-lg-8">
              <div class="form-group">
                <label class="col-lg-3 control-label"><span class="redstart">*</span>手机号:</label>
                <div class="col-lg-9">
                  <input type="text" class="form-control" name="mobile" [(ngModel)]="noReactiveFormField.mobile"/>
                </div>
              </div>
            </div>
            <div class="col-lg-4">
              <div *ngIf="noReactiveFormField.mobilewarn"
                   style="background-color: #FFEFEF;width: 100%;height: 33px;text-align: center;">
                <span style="line-height: 33px;color: red">{{noReactiveFormField.mobilewarntext}}</span>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-lg-8">
              <div class="form-group">
                <label class="col-lg-3 control-label"><span class="redstart">*</span>验证码:</label>
                <div class="col-lg-9">
                  <div class="input-group">
                    <input type="text" class="form-control" name="moblieyzm"
                           [(ngModel)]="noReactiveFormField.moblieyzm"/>
                    <span class="input-group-addon" id="basic-addon1" style="cursor: pointer;" (click)="getmoblieYzm()">{{btnMsg}}</span>
                  </div>
                </div>
              </div>
            </div>
            <div class="col-lg-4">
              <div *ngIf="noReactiveFormField.moblieyzmwarn"
                   style="background-color: #FFEFEF;width: 100%;height: 33px;text-align: center;">
                <span style="line-height: 33px;color: red">{{noReactiveFormField.moblieyzmwarntext}}</span>
              </div>
            </div>
          </div>
          <div class="row" *ngIf="sysBase=='61'">
            <div class="col-lg-8">
              <div class="form-group">
                <label class="col-lg-3 control-label">邮箱:</label>
                <div class="col-lg-9">
                  <input type="text" class="form-control" name="email" (keyup)="emailChange()"
                         [(ngModel)]="noReactiveFormField.email"/>
                </div>
              </div>
            </div>
            <div class="col-lg-4">
              <div *ngIf="noReactiveFormField.emailwarn"
                   style="background-color: #FFEFEF;width: 100%;height: 33px;text-align: center;">
                <span style="line-height: 33px;color: red">{{noReactiveFormField.emailwarntext}}</span>
              </div>
            </div>
          </div>
        </div>
      </form>
      <!--确认 / 返回-->
      <div class="actionbtn">
        <button class="btn btn-danger" type="button" (click)="backToLogin()">关 闭</button>&nbsp;&nbsp;
        <button class="btn btn-info" type="button" (click)="sure()">确 认</button>
      </div>
    </div>
  `,
  styles: [
    ".uppwdRoom{width: 800px;margin: 50px auto;background-color: #fff;padding: 20px;border-radius: 10px;position: relative}",
    ".uppwdRoom>.actionbtn{position: absolute;bottom: 20px;right: 20px;}",
    "#xgpwdRoom{display: none}",
    "#wsxxRoom{display: none}",
    "#tips{font-size: 12px;width: 400px;height: 25px;margin: 5px 0 0 0px;}",
    "#tips>span{background: #D1D1D1;float: left;width: 60px;height: 15px;overflow: hidden;margin-right: 10px;line-height: 20px;}",
    "#tips label{color:#698bac }",
    "#tips .init{background-color:#D1D1D1 }",
    // 密码强度  弱,  只画一个span
    "#tips .s0{background-color:#E93106}",
    // 密码强度  中，画前两个span
    "#tips .s1{background-color: #FF8400}",
    // 密码强度 高，三个span都画
    "#tips .s2{background-color: #5BBA48}",
    // 验证规则列表 弹框
    "#gzPpopover{width: 1px;height: 33px;margin-top: 10px;visibility: hidden}",
    "#gzerror{background-color: #FFEFEF;width: 100%;height: 33px;text-align: center;}",
    "#gzerror>span{line-height: 33px;color: red}",
    ".redstart{color:red;display:inline-block;width:20px;vertical-align: middle; text-align:center;}"
  ]
})
export class UsercoreComponent implements OnInit {
  userinfo: any;
  loginname: string;
  noReactiveFormField: any = {
    oldpwdv: "",
    oldpwdwarn: true,
    oldpwdwarntext: "旧密码不能为空",
    newpwdv: "",
    newpwdwarn: false,
    newpwdwarntext: "",
    newpwdqdtx: "密码强度低",
    qrpwdv: "",
    rqpwdwarn: false,
    rqpwdwarntext: "",
    mobile: "",
    mobilewarn: false,
    mobilewarntext: "",
    moblieyzm: "",
    moblieyzmwarn: false,
    moblieyzmwarntext: "",
    email: "",
    emailwarn: false,
    emailwarntext: ""
  }


  sureoknum: number = 2;
  successflag_mm: boolean = false; // all 情况，修改密码成功
  successtext_mm: string = "";
  successflag_sjh: boolean = false; // all 情况，绑定手机成功
  successtext_sjh: string = "";
  ucoreqk: string = "";

  btnMsg: string = "获取验证码";
  cutdowntimev: number = 120;
  cutdownLock: any;
  cansend: boolean = true;


  label: string = "";  // 页面是干啥的说明
  sysBase: string = "";
  pwdroomHeightstr: string = "0px";

  /**
   * 用户详情
   */
  getuserinfo(): void {
    this.commservice.getUserinfo((info) => {
      this.userinfo = info;
      this.loginname = info.name ? decodeURIComponent(info.name) : "";
    });
  }

  /**
   * 控制页面
   */
  ctrpageshow(): void {
    this.ucoreqk = this.localStorageService.get("ucoreQK");
    // all 情况， 既要修改密码， 又要绑定手机号，2个接口的执行结果记录
    const uppwdsuccessflag = this.localStorageService.get("uppwdflag");
    const bindmobilesuccessflag = this.localStorageService.get("bindsjhflag");
    if (uppwdsuccessflag == "true") {
      this.successflag_mm = true;
      this.successtext_mm = "修改密码成功";
    } else {
      this.successflag_mm = false;
      this.successtext_mm = "";
    }
    if (bindmobilesuccessflag == "true") {
      this.successflag_sjh = true;
      this.successtext_sjh = "绑定手机号成功";
    } else {
      this.successflag_sjh = false;
      this.successtext_sjh = "";
    }

    if (this.ucoreqk == "all") {
      this.label = "修改基础信息";
      $("#xgpwdRoom").show();
      $("#wsxxRoom").show();
      this.initgzprop();
      this.closeProp();
    }
    if (this.ucoreqk == "onlymm") {
      this.label = "修改密码";
      $("#xgpwdRoom").show();
      $("#wsxxRoom").hide();
      this.initgzprop();
      this.closeProp();
    }
    if (this.ucoreqk == "onlysj") {
      this.label = "完善信息";
      $("#wsxxRoom").show();
      $("#xgpwdRoom").hide();
    }
  }


  /**
   * 确认
   */
  sure(): void {
    switch (this.ucoreqk) {
      case "all":
        // 判断修改密码是否成功了， 成功了，就不验证修改密码的，就不再调用修改密码了
        if (this.successflag_mm) {
          if (this.successflag_sjh) {
            //已经跳走了
          } else {
            // onlysj
            this.onlysjhDone();
          }
        } else {
          if (this.successtext_sjh) {
            // onlymm
            this.onlymmDone();
          } else {
            this.allDone();
          }
        }
        break;
      case "onlymm":
        this.onlymmDone();
        break;
      case "onlysj":
        this.onlysjhDone();
        break;
    }
  }

  /**
   * 只修改密码
   */
  onlymmDone(): void {
    // 修改密码
    if (!this.noReactiveFormField.oldpwdv) {
      this.noReactiveFormField.oldpwdwarn = true;
      this.noReactiveFormField.oldpwdwarntext = "旧密码不能为空";
      return;
    }
    this.noReactiveFormField.oldpwdwarn = false;
    this.noReactiveFormField.oldpwdwarntext = "";


    this.pwdqdjb();

    if (this.noReactiveFormField.newpwdwarn || this.noReactiveFormField.rqpwdwarn) {
      return;
    }
    this.sureoknum = 1;
    this.uppassDone(); //修改密码
  }


  /**
   * 只绑定手机号
   */
  onlysjhDone(): void {
    // 绑定手机
    if (!this.noReactiveFormField.mobile) {
      this.noReactiveFormField.mobilewarn = true;
      this.noReactiveFormField.mobilewarntext = "手机号不能为空";
      return
    }
    this.noReactiveFormField.mobilewarn = false;
    this.noReactiveFormField.mobilewarntext = "";
    if (!this.noReactiveFormField.moblieyzm) {
      this.noReactiveFormField.moblieyzmwarn = true;
      this.noReactiveFormField.moblieyzmwarntext = "验证码不能为空";
      return
    }
    this.noReactiveFormField.moblieyzmwarn = false;
    this.noReactiveFormField.moblieyzmwarntext = "";
    if (this.sysBase == "61") {
      if (this.noReactiveFormField.emailwarn) {
        return
      }
    }
    this.sureoknum = 1;
    this.bindMobliedone(); // 绑定手机号
  }


  /**
   * 修改密码 +  绑定手机号
   */
  allDone(): void {
    // 修改密码
    if (!this.noReactiveFormField.oldpwdv) {
      this.noReactiveFormField.oldpwdwarn = true;
      this.noReactiveFormField.oldpwdwarntext = "旧密码不能为空";
      return;
    }
    this.noReactiveFormField.oldpwdwarn = false;
    this.noReactiveFormField.oldpwdwarntext = "";
    this.pwdqdjb();
    if (this.noReactiveFormField.newpwdwarn || this.noReactiveFormField.rqpwdwarn) {
      return;
    }
    // 绑定手机
    if (!this.noReactiveFormField.mobile) {
      this.noReactiveFormField.mobilewarn = true;
      this.noReactiveFormField.mobilewarntext = "手机号不能为空";
      return
    }
    this.noReactiveFormField.mobilewarn = false;
    this.noReactiveFormField.mobilewarntext = "";

    if (!this.noReactiveFormField.moblieyzm) {
      this.noReactiveFormField.moblieyzmwarn = true;
      this.noReactiveFormField.moblieyzmwarntext = "验证码不能为空";
      return
    }
    this.noReactiveFormField.moblieyzmwarn = false;
    this.noReactiveFormField.moblieyzmwarntext = "";

    if (this.sysBase == "61") {
      if (this.noReactiveFormField.emailwarn) {
        return
      }
    }
    this.sureoknum = 2;
    this.uppassDone(); //修改密码
    this.bindMobliedone(); // 绑定手机号
  }

  uppassDone(): void {
    const url = "manager/user/modifyPassword";
    this.itservice.kwPtPost(url, {
      oldPassword: this.noReactiveFormField.oldpwdv,
      newPassword: this.noReactiveFormField.newpwdv,
      confirmNewPassword: this.noReactiveFormField.qrpwdv,
    }).subscribe(resp => {
      this.commservice.handResponse("put", url, resp, (arg1, resp, ar2) => {
        if (arg1) {
          if (ar2) {
            this.successflag_mm = true;
            this.successtext_mm = "修改密码成功";
            this.checkok();
          } else {
            this.successflag_mm = false;
            this.successtext_mm = "";
            this.commservice.myswal("warning", resp, "", "ts", null);
          }
          this.localStorageService.set("uppwdflag", this.successflag_mm + "");
        } else {
          this.uppassDone();
        }
      });
    });
  }

  bindMobliedone(): void {
    const url = "manager/user/BindMobile";
    this.itservice.kwPtPost(url, {
      mobile: this.noReactiveFormField.mobile.toString().trim(),
      code: this.noReactiveFormField.moblieyzm.toString().trim()
    }).subscribe(resp => {
      this.commservice.handResponse("put", url, resp, (arg1, resp, ar2) => {
        if (arg1) {
          if (ar2) {
            this.successflag_sjh = true;
            this.successtext_sjh = "绑定手机号成功";
            this.checkok();
          } else {
            this.successflag_sjh = false;
            this.successtext_sjh = "";
            this.commservice.myswal("warning", resp, "", "ts", null);
          }
          this.localStorageService.set("bindsjhflag", this.successflag_sjh + "");
        } else {
          this.uppassDone();
        }
      });
    })
  }

  /**
   * 新密码校验
   */
  newpwdChange(): void {
    $("#gzPpopover").popover("hide");
    $("#gzPpopover").hide();
    const newpwd = this.noReactiveFormField.newpwdv;
    const qdnum = this.pwdqdjb();
    // 还原为最初
    $("#tips span")[0].className = "init";
    $("#tips span")[1].className = "init";
    $("#tips span")[2].className = "init";
    if (qdnum == 0) {
      this.noReactiveFormField.newpwdqdtx = "密码强度低";
    } else if (qdnum == 1) {
      this.noReactiveFormField.newpwdqdtx = "密码强度弱";
      $("#tips span")[0].className = "s0";
    } else if (qdnum == 2) {
      this.noReactiveFormField.newpwdqdtx = "密码强度中";
      $("#tips span")[0].className = "s1";
      $("#tips span")[1].className = "s1";
    } else if (qdnum == 3) {
      this.noReactiveFormField.newpwdqdtx = "密码强度高";
      $("#tips span")[0].className = "s2";
      $("#tips span")[1].className = "s2";
      $("#tips span")[2].className = "s2";
    }
    if (newpwd != this.noReactiveFormField.qrpwdv) {
      this.noReactiveFormField.rqpwdwarn = true;
      this.noReactiveFormField.rqpwdwarntext = "确认密码和新密码不一致";
    } else {
      this.noReactiveFormField.rqpwdwarn = false;
      this.noReactiveFormField.rqpwdwarntext = "";
    }
  }


  /**
   * 校验新密码， 并判断密码强度
   * @returns {number}
   */
  pwdqdjb(): number {
    const newpwd = this.noReactiveFormField.newpwdv ? this.noReactiveFormField.newpwdv : "";
    let retnum: number = 0;
    if (!newpwd) {
      this.noReactiveFormField.newpwdwarn = true;
      this.noReactiveFormField.newpwdwarntext = "新密码不能为空";
      retnum = 0;
    } else {
      if (newpwd.trim().length < 8 || newpwd.trim().length > 16) {
        this.noReactiveFormField.newpwdwarn = true;
        this.noReactiveFormField.newpwdwarntext = "新密码长度为8-16位";
        retnum = 0;
      } else {
        const regex = /^[0-9a-zA-Z]+$/;  // 数字或者字母
        const regex2 = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~！@#￥%……&*（）——\-+={}|《》？：“”【】、；‘'，。、]/;  //特殊字符
        const regex3 = /^[^\u4e00-\u9fa5]+$/; // 不能包含中文的字符串
        if (!regex3.test(newpwd)) {
          this.noReactiveFormField.newpwdwarn = true;
          this.noReactiveFormField.newpwdwarntext = "新密码不合法";
          retnum = 0;
        } else {
          // 符合规则， 判断 强度
          this.noReactiveFormField.newpwdwarn = false;
          this.noReactiveFormField.newpwdwarntext = "";
          retnum = 0;   // 初始化强度为  无
          if (newpwd.trim().length >= 8) {
            if (regex.test(newpwd)) {
              // 位数大于等于8
              // 包含 数字或者字母
              retnum = 1;   //强度为 弱
            }
          }
          if (/[a-zA-Z]/.test(newpwd) && /[0-9]/.test(newpwd)) {
            // 位数不限制
            // 同时包含 字母，数字
            retnum = 2;   //强度为 中
          }
          if (newpwd.trim().length >= 10) {
            if (/[a-zA-Z]/.test(newpwd) && /[0-9]/.test(newpwd) && regex2.test(newpwd)) {
              // 位数大于等于10
              // 同时包含字母，数字，特殊字符
              retnum = 3;   //强度为 高
            }
          }
        }
      }
    }
    return retnum;
  }

  /**
   * 确认密码校验
   */
  qrpwdChange(): void {
    const qrpwd = this.noReactiveFormField.qrpwdv;
    if (qrpwd != this.noReactiveFormField.newpwdv) {
      this.noReactiveFormField.rqpwdwarn = true;
      this.noReactiveFormField.rqpwdwarntext = "确认密码和新密码不一致";
    } else {
      this.noReactiveFormField.rqpwdwarn = false;
      this.noReactiveFormField.rqpwdwarntext = "";
    }
  }

  /**
   * 邮箱校验
   */
  emailChange(): void {
    const emailv = this.noReactiveFormField.email;
    if (emailv) {
      //开始必须是一个或者多个单词字符或者是-，加上@，然后又是一个或者多个单词字符或者是-。然后是点“.”和单词字符和-的组合，可以有一个或者多个组合。
      const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
      if (!regex.test(emailv)) {
        this.noReactiveFormField.emailwarn = true;
        this.noReactiveFormField.emailwarntext = "邮箱格式错误";
      } else {
        this.noReactiveFormField.emailwarn = false;
        this.noReactiveFormField.emailwarntext = "";
      }
    } else {
      //非必填
      this.noReactiveFormField.emailwarn = false;
      this.noReactiveFormField.emailwarntext = "";
    }
  }

  checkok(): void {
    this.sureoknum--;
    if (!this.sureoknum) {
      this.router.navigate(["/login"]);
    }
  }

  backToLogin(): void {
    const href = this.localStorageService.get("href");
    if (href) {
      this.router.navigate([href])
    } else {
      this.router.navigate(["login"]);
    }


  }


  getmoblieYzm(): void {
    if (!this.cansend) {
      return
    }
    const mobilev = this.commservice.removeSpace(true, this.noReactiveFormField.mobile);
    if (!mobilev) {
      this.noReactiveFormField.mobilewarn = true;
      this.noReactiveFormField.mobilewarntext = "手机号不能为空";
      return
    }
    this.noReactiveFormField.mobilewarn = false;
    this.noReactiveFormField.mobilewarntext = "";
    const regex = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
    const valid = regex.test(mobilev);
    if (!valid) {
      this.noReactiveFormField.mobilewarn = true;
      this.noReactiveFormField.mobilewarntext = "无效的手机号码";
      return
    }
    this.noReactiveFormField.mobilewarn = false;
    this.noReactiveFormField.mobilewarntext = "";

    if (this.cutdownLock) {
      clearInterval(this.cutdownLock);
    }
    // 倒计时开始
    this.cutdowntimev = 120;
    this.cutdowntimev--;
    this.btnMsg = `${this.cutdowntimev}秒`;
    this.cansend = false;
    // 获取手机验证码 （和 倒计时2个线程，获取成功不影响倒计时）
    const url = "manager/sms/sendMsg";
    this.itservice.kwPtPost(url, {
      smsCodeType: "change",
      mobile: mobilev
    }).subscribe(resp => {
      this.commservice.handResponse("put", url, resp, (arg1, resp, arg2) => {
        // 此接口没有返回信息
        if (arg1) {

        }
      });
    });

    // 倒计时
    this.cutdownLock = setInterval(() => {
      this.cutdowntimev--;
      this.btnMsg = `${this.cutdowntimev}秒`;
      if (this.cutdowntimev == 0) {
        clearInterval(this.cutdownLock);
        this.btnMsg = "获取验证码";
        this.cansend = true;
      }
    }, 1000);
  }


  // 初始化 prop内容
  initgzprop(): void {
    let contentstr = "<div><i class='fa fa-info-circle'></i>&nbsp;<span>8-16位字符</span></div>";
    contentstr += "<div><i class='fa fa-info-circle'></i>&nbsp;<span>字母、数字、字符组成</span></div>";
    //contentstr += "<div><i class='fa fa-info-circle'></i>&nbsp;<span>只能包含字母、数字和下划线</span></div>";
    $("#gzPpopover").popover({
      html: true,
      content: contentstr
    });
  }

  // input获取焦点的时候，显示 prop
  showProp(): void {
    if (this.noReactiveFormField.oldpwdv) {
      this.noReactiveFormField.oldpwdwarn = false;
    } else {
      this.noReactiveFormField.oldpwdwarn = true;
    }
    this.noReactiveFormField.newpwdwarn = false;
    $("#gzPpopover").show();
    $("#gzPpopover").popover("show");
  }

  //  点击其他地方的时候，prop隐藏， 提示信息显示
  closeProp(): void {
    const that = this;
    $(".uppwdRoom").click(function (e) {
      const targetdom = e.target;
      if ($(targetdom).attr("name") != 'newpwd') {
        $("#gzPpopover").popover("hide");
        $("#gzPpopover").hide();
        if (that.noReactiveFormField.newpwdwarntext) {
          // 如果密码规则不通过才显示
          that.noReactiveFormField.newpwdwarn = true;
        }
      }
    });
  }

  constructor(private commservice: CommService,
    private itservice: MyhttpService,
    private router: Router,
    private localStorageService: LocalStorageService) {

  }

  ngOnInit() {
    this.commservice.getSysmsg2((resp) => {
      if (resp) {
        this.sysBase = resp.sysBase;
      }
    });
    this.getuserinfo();
    this.ctrpageshow();
    this.pwdroomHeightstr = (this.commservice.getViewPort().height - this.commservice.topmenuH - this.commservice.topH) + "px";
  }
}
